#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Time: 2019/6/2  10:17
# @Author: 余浪人
# @email: yulangren520@gmail.com


class Item():
    def __init__(self, title, superior: int, content=None, download1=None, download2=None, thumb_img=None, clicks=0,
                 author=None, keyword=None, description=None, source=None, promulgator=None, contributor=None,
                 permissions=None, is_focus=None, is_roll=None, is_roll_text=None, is_index_stick=None,
                 is_list_stick=None, is_recommend=None, is_pass=None, weight=None):
        self.title = title
        self.superior = superior
        self.content = content
        self.download1 = download1
        self.download2 = download2
        self.thumb_img = thumb_img
        self.clicks = clicks
        self.author = author
        self.keyword = keyword
        self.description = description
        self.source = source
        self.promulgator = promulgator
        self.contributor = contributor
        self.permissions = permissions
        self.is_focus = is_focus
        self.is_roll = is_roll
        self.is_roll_text = is_roll_text
        self.is_index_stick = is_index_stick
        self.is_list_stick = is_list_stick
        self.is_recommend = is_recommend
        self.is_pass = is_pass
        self.weight = weight

    def save(self, db, model):
        obj = model()
        data = {"title": self.title, "superior": self.superior, "content": self.content, "download1": self.download1,
                "download2": self.download2, "thumb_img": self.thumb_img, "clicks": self.clicks, "author": self.author,
                "keyword": self.keyword, "description": self.description, "source": self.source,
                "promulgator": self.promulgator, "contributor": self.contributor, "permissions": self.permissions,
                "is_focus": self.is_focus, "is_roll": self.is_roll, "is_roll_text": self.is_roll_text,
                "is_index_stick": self.is_index_stick, "is_list_stick": self.is_list_stick,
                "is_recommend": self.is_recommend, "is_pass": self.is_pass, "weight": self.weight}
